package View.PayTheFeet;

import View.Index.Index_user;
import domain.User;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class successPage extends JFrame {
    public static void main(String[] args) {
       // new successPage().setVisible(true);
    }

    public successPage(String Type, Double money, String dornum, User user){
        init();
        componentInit(Type,money,dornum,user);
    }

    public void init(){
        this.setTitle("提示");
        this.setSize(600,400);
        this.setResizable(true);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLayout(null);
    }
    public void componentInit(String Type,Double money,String dornum,User user){
        //------------------JLabel--------------------
        JLabel label1= new JLabel();
        label1.setText("缴费成功!"+"您已为"+dornum+"宿舍缴"+Type+String.valueOf(money)+"元");
        label1.setBounds(135,45,306,136);


        //------------------JButton--------------------
        JButton button1= new JButton();
        button1.setText("返回主页");
        button1.setBounds(124,238,95,27);
        JButton button2= new JButton();
        button2.setText("返回缴费界面");
        button2.setBounds(355,240,116,30);





        this.add(label1);
        this.add(button1);
        this.add(button2);

        button1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                dispose();
                new Index_user(user).setVisible(true);
            }
        });

        button2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                dispose();
                new PayTheFeets(user).setVisible(true);
            }
        });
    }
}
